<?php
	namespace Home\Controller;
	use Think\Controller;

	Class SingleController extends InitializeController{
		Public function index(){
			$db = M('Detailedpic');
			if (I('get.id')=='') {
				$pid = M('Product')->where("mid=%d",I('get.mid'))->field('id')->select();
				$this->det=$db->where("pid=%d",$pid['0']['id'])->select();
				$this->pro = M('Product')->where("id=%d",$pid['0']['id'])->select();
				$cid = M('pro_col')->where("pid=%d",$pid['0']['id'])->select();
			}else{
				$this->det=$db->where("pid=%d",I('get.id'))->select();
				$this->pro = M('Product')->where("id=%d",I('get.id'))->select();
				$cid = M('pro_col')->where("pid=%d",I('get.id'))->select();
			}

			foreach ($cid as $v) {
				$col = M('color')->where("id=%d",$v['cid'])->field('color')->select();
				$color[] = $col['0']['color'];
			}
			$this->assign('color',$color);
			$this->display();
		}
	}
 ?>
